﻿using System.Windows;
using System.Windows.Threading;

namespace com.bodurov.WpfControls.SampleApp
{
    public partial class App : Application
    {
        private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            e.Handled = true;

            var errorView = new ErrorView();
            errorView.SetError(e.Exception.ToString());
            errorView.Show();

            foreach (Window window in this.Windows)
            {
                if (window != errorView)
                {
                    window.Close();
                }
            }
        }
    }
}
